package edu.scau.misp.backend_module.domain;

import java.io.Serializable;
import java.math.BigDecimal;

public class OrderDishAddition extends OrderItem{
//    public class OrderDishAddition implements Serializable
    private  Long orderDishAdditionId;

    private  Long orderId;
    private  Long dishAdditionSn;
    private  Long orderQuantity;

    private Order order;

    private DishAddition dishAddition;

    public Long getOrderDishAdditionId() {
        return orderDishAdditionId;
    }

    public void setOrderDishAdditionId(Long orderDishAdditionId) {
        this.orderDishAdditionId = orderDishAdditionId;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getDishAdditionSn() {
        return dishAdditionSn;
    }

    public void setDishAdditionSn(Long dishAdditionSn) {
        this.dishAdditionSn = dishAdditionSn;
    }

    public Long getOrderQuantity() {
        return orderQuantity;
    }

    public void setOrderQuantity(Long orderQuantity) {
        this.orderQuantity = orderQuantity;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public DishAddition getDishAddition() {
        return dishAddition;
    }

    public void setDishAddition(DishAddition dishAddition) {
        this.dishAddition = dishAddition;
    }
    /**
     * 计算小计
     * @return 小计
     */
    public BigDecimal getSubTotal(){
        BigDecimal subTotal =  new BigDecimal(dishAddition.getComboPrice()).multiply(new BigDecimal(orderQuantity));
        return subTotal;
    }

    public OrderDishAddition(Long orderDishAdditionId, Long orderId, Long dishAdditionSn, Long orderQuantity, Order order, DishAddition dishAddition) {
        this.orderDishAdditionId = orderDishAdditionId;
        this.orderId = orderId;
        this.dishAdditionSn = dishAdditionSn;
        this.orderQuantity = orderQuantity;
        this.order = order;
        this.dishAddition = dishAddition;
    }

    public OrderDishAddition() {
    }

    @Override
    public String toString() {
        return "OrderDishAddition{" +
                "orderDishAdditionId=" + orderDishAdditionId +
                ", orderId=" + orderId +
                ", dishAdditionSn=" + dishAdditionSn +
                ", orderQuantity=" + orderQuantity +
                ", order=" + order +
                ", dishAddition=" + dishAddition +
                '}';
    }
}
